#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    vector<int> searchRange(vector<int> &nums, int target)
    {
        if (nums.size() == 0)
            return {-1, -1};
        //if (nums.size() == 1)
        //    return nums[0] == target ? vector<int>{0, 0} : vector<int>{-1, -1};
        int start = 0, end = nums.size() - 1;
        while (start < end)
        {
            int mid = (start + end) / 2;
            if (nums[mid] < target)
            {
                start = mid + 1;
            }
            else
            {
                end = mid;
            }
        }
        if (nums[start] != target)
            return vector<int>{-1, -1};
        int begin = start;
        end = nums.size() - 1;
        while (start < end)
        {
            int mid = (start + end + 1) / 2;
            if (nums[mid] <= target)
            {
                start = mid;
            }
            else
            {
                end = mid - 1;
            }
        }
        return {begin, start};
    }
};

int main()
{
    cout << "Code34" << endl;
    Solution s;
    vector<int> nums = {1};
    vector<int> res = s.searchRange(nums, 1);
    cout << res[0] << ',' << res[1] << endl;
    return 0;
}